﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="CadastroFuncionario.aspx.cs" Inherits="LarDosIdosos.CadastroFuncionario" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:HiddenField ID="hiddenFieldCodigo" runat="server" />
		    <div style="float:left;width:70%;">
	            <asp:LinkButton ID="linkButtonVoltar" runat="Server" OnClick="linkButtonVoltar_OnClick" Style="float:right;">Voltar</asp:LinkButton>
	        </div>
	        <div style="float:left;width:100%;text-align:center;">
	            <asp:Label ID="labelFeedback" runat="server"/>
	        </div>
		    <div id="divAlteracao" runat="server" style="float:left;width:100%;">
		        <table width="50%" cellspacing="20px" align="center" >
		            <tr>
		                <td>
		                    Nome do Funcionário:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxNome" runat="server" Width="100%"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Cargo:
		                </td>
		                <td>
		                    <asp:DropDownList ID="dropDownListCargo" runat="server" AutoPostBack="true" OnSelectedIndexChanged="dropDownListCargo_OnSelectedIndexChanged" >
		                        <asp:ListItem Text="Administrador" Value="1"></asp:ListItem>
		                        <asp:ListItem Text="Assistente Social" Value="2"></asp:ListItem>
		                        <asp:ListItem Text="Almoxarife" Value="3"></asp:ListItem>
		                        <asp:ListItem Text="Médico" Value="4"></asp:ListItem>
		                        <asp:ListItem Text="Tec. em Enfermagem" Value="5"></asp:ListItem>
		                    </asp:DropDownList>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Estado Civil:
		                </td>
		                <td>
		                    <asp:DropDownList ID="dropDownListEstadoCivil" runat="server">
		                        <asp:ListItem Text="Solteiro" Value="1"></asp:ListItem>
		                        <asp:ListItem Text="Casado" Value="2"></asp:ListItem>
		                    </asp:DropDownList>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    CPF:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxCpf" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    RG:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxRg" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    E-mail:
		                </td>
		                <td>
		                    <asp:TextBox ID="TextBoxEmail" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Senha:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxSenha" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
                        <td>
                            Telefones:
                        </td>
                        <td>
                            <table width="100%">
                                <asp:Repeater id="repeaterTelefones" runat="server" OnItemCommand="repeaterTelefones_ItemCommand">
                                    <ItemTemplate>
                                    <tr>
								        <td><asp:HiddenField ID="hiddenFieldCodigoTelefone" runat="server" Value='<%# Eval("Codigo_Telefone") %>' /><asp:Literal ID="literalNumero" runat="server" Text='<%# Eval("Numero_Telefone") %>'></asp:Literal></td><td><asp:ImageButton id="imageButtonRemover" runat="server" CommandName="deletar" CommandArgument='<%# Eval("Codigo_Telefone") %>' AlternateText="Excluir"/></td>
                                    </tr>
							        </ItemTemplate>
                                </asp:Repeater>
                                <tr>
						            <td colspan="2"><asp:TextBox id="textBoxAddTelefone" runat="server"></asp:TextBox><asp:Button id="buttonAddTelefone" runat="server" OnClick="buttonAddTelefone_Click" Text="Adicionar"></asp:Button></td>
					            </tr>
                            </table>
                        </td>
                    </tr>
		            <tr>
		                <td>
		                    Grau de instrução:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxGrauDeIntrucao" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Nome do Pai:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxNomeDoPai" runat="server" Width="100%"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Nome da Mãe:
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxNomeDaMae" runat="server" Width="100%"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Sexo:
		                </td>
		                <td>
		                <asp:RadioButtonList ID="radioButtonListSexo" runat="server">
		                    <asp:ListItem Text="Masculino" Value="1" />
		                    <asp:ListItem Text="Feminino" Value="2"/>
		                </asp:RadioButtonList>
		                                    
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Data de Nascimento:
		                </td>
		                <td>
		                    <asp:TextBox ID="textDataDeNascimento" runat="server" CssClass="data"></asp:TextBox>
		                </td>
		            </tr>
		            <tr id="trTipoRegistro" runat="server" Visible="false">
		                <td>
                            <asp:Label ID="labelTipoRegistro" runat="server"></asp:Label>
		                </td>
		                <td>
		                    <asp:TextBox ID="textBoxRegistro" runat="server"></asp:TextBox>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                                   
		                </td>
		                <td>
		                    <asp:Button ID="buttonSalvar" runat="server" Text="Salvar" OnClick="buttonSalvar_Onclick" Visible="true"/>
		                </td>
		            </tr>
		
		        </table>
		    </div>
		    <div id="divVisualizacao" runat="server" style="float:left;width:100%;" Visible="false">
                <div  style="float:left;margin-left:200px" > 
                    <script src="jscript/jquery-1.8.2.min.js" type="text/javascript"></script>
                    <script src="jscript/jquery.printElement.js" type="text/javascript"></script>
                    <script  type="text/javascript">
                        function PrintDiv() {
                            $('.tableFuncionario').printElement();
                        }
                    </script>
		            <a href='#' onclick="PrintDiv()">
			            <asp:Image BorderWidth="0" runat="server" ID="imagePrint" ImageUrl="~/Imagens/IconPrintPage.png" style="margin-right:20px;" ToolTip="Imprimir este cadastro"/>
		            </a>
                </div>
		        <table class="tableFuncionario" width="50%" cellspacing="20px" align="center" >
		            <tr>
		                <td>
		                    Nome do Funcionário:
		                </td>
		                <td>
		                    <asp:Label ID="labelNome" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Cargo:
		                </td>
		                <td>
		                    <asp:Label ID="labelCargo" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Estado Civil:
		                </td>
		                <td>
		                    <asp:Label ID="labelEstadoCivil" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    CPF:
		                </td>
		                <td>
		                    <asp:Label ID="labelCpf" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    RG:
		                </td>
		                <td>
		                    <asp:Label ID="labelRg" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    E-mail:
		                </td>
		                <td>
		                    <asp:Label ID="labelEmail" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Senha:
		                </td>
		                <td>
		                    <asp:Label ID="labelSenha" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr bgcolor="#EEEEEE">
                        <td bgcolor="#FFFFFF">
                            Telefones:
                        </td>
                        <td bgcolor="#FFFFFF">
                            <table width="100%">
                                <asp:Repeater id="repeaterTelefonesVisualizacao" runat="server">
                                    <ItemTemplate>
                                    <tr>
								        <td><%# Eval("Numero_Telefone") %></td>
                                    </tr>
							        </ItemTemplate>
                                </asp:Repeater>
                            </table>
                        </td>
                    </tr>
		            <tr>
		                <td>
		                    Grau de instrução:
		                </td>
		                <td>
		                    <asp:Label ID="labelGrauDeInstrucao" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Nome do Pai:
		                </td>
		                <td>
		                    <asp:Label ID="labelNomeDoPai" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Nome da Mãe:
		                </td>
		                <td>
		                    <asp:Label ID="labelNomeDaMae" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Sexo:
		                </td>
		                <td>
		                    <asp:Label ID="labelSexo" runat="server"></asp:Label>               
		                </td>
		            </tr>
		            <tr>
		                <td>
		                    Data de Nascimento:
		                </td>
		                <td>
		                    <asp:Label ID="labelDataDeNascimento" runat="server"></asp:Label>
		                </td>
		            </tr>
		            <tr id="trTipoRegistroExibicao" runat="server" Visible="false">
		                <td>
                            <asp:Label ID="labelTipoRegistroExibicao" runat="server"></asp:Label>
		                </td>
		                <td>
		                    <asp:Label ID="labelRegistroExibicao" runat="server"></asp:Label>
		                </td>
		            </tr>
		        </table>
		    </div>
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="repeaterTelefones" />
            <asp:PostBackTrigger ControlID="buttonSalvar" />
            <asp:PostBackTrigger ControlID="buttonAddTelefone" />
            <asp:PostBackTrigger ControlID="dropDownListCargo" />
            
        </Triggers>
    </asp:UpdatePanel>
    
    <script type="text/javascript">
        carregarCalendario = function () {
            $(".data").datepicker({ dateFormat: "dd/mm/yy" });
        };

        carregarMascara = function () {
            $("#<%= textBoxCpf.ClientID %>").mask("999.999.999-99");
            $("#<%= textBoxAddTelefone.ClientID %>").mask("(999)9999-9999");
            
        };
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(carregarCalendario);
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(carregarMascara);
	</script>
</asp:Content>
